/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package util;

import java.util.Iterator;
import java.util.List;
import java.util.Vector;

/**
 *
 * @author andreas
 */
public class TreeNode<T> {
    private T value;
    private List<TreeNode<T>> children;

    public TreeNode(T value) {
        children = new Vector<TreeNode<T>>();
        this.value = value;
    }

    public void setValue(T value) {
        this.value = value;
    }

    public T getValue() {
        return value;
    }

    public Iterator<TreeNode<T>> getChildren() {
        return children.iterator();
    }

    public void addChild(TreeNode<T> child) {
        children.add(child);
    }

    public void removeChild(TreeNode<T> child) {
        children.remove(child);
    }

    public boolean hasChilds() {
        if(children.isEmpty()) {
            return false;
        }
        else {
            return true;
        }
    }
}
